<?php Session::Set("URLSENDMAIL", "index.php?" . $_SERVER['QUERY_STRING']);?>
<script language=JavaScript src="js/ts_picker.js" type=text/javascript charset=UTF-8></script>
<table width="100%" border="0" cellpadding="5" cellspacing="2" class="list">
<tbody>
  <tr>
  	<td colspan="7">
  		<fieldset style='border:1px solid #afe14c;margin: 7px 0;padding: 10px 10px'>
  		<legend style='font: 700 14px Arial, Helvetica, sans-serif;padding: 0 5px;margin: 0 10px;color: #73b304'>Nhập thông tin tìm kiếm đơn hàng</legend>
  		<form id="form1" name="form1" method="post" action="index.php?m=home&a=search<?php echo constants::$pathUrl;?>">
		  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
		    <tr>
		      <th width="255" align="right">Họ tên :<input type="text" name="hoten" id="hoten" value="<?php echo $this->getPost['hoten'];?>"/></th>
		      <td width="17" align="left">&nbsp;</td>
		      <th width="275" align="right">Số điện thoại :<input type="text" name="phone" id="phone" value="<?php echo $this->getPost['phone'];?>"/></th>
		      <td align="left">&nbsp;</td>
		    </tr>
		    <tr>
		      <th colspan="4" align="left">&nbsp;&nbsp;Mã đơn hàng :<input maxlength="15" type="text" name="maHang" id="maHang" value="<?php echo $this->getPost['maHang'];?>"/></th>
		    </tr>
		    <tr>
		      <th width="255" align="right">Từ ngày :<input type="text" name="dateStart" id="dateStart" value="<?php echo $this->getPost['dateStart'];?>" readonly="readonly"/></th>
		      <td width="17" align="left"><img style="cursor:pointer;" onclick="document.form1.dateStart.value='';show_calendar('document.form1.dateStart', document.form1.dateStart.value)" alt="" src="images/default/calendar-blue.gif"></td>
		      <th width="275" align="right">Đến ngày :<input type="text" name="dateEnd" id="dateEnd" value="<?php echo $this->getPost['dateEnd'];?>" readonly="readonly"/></th>
		      <td align="left"><img style="cursor:pointer;" onclick="document.form1.dateEnd.value='';show_calendar('document.form1.dateEnd', document.form1.dateEnd.value)" alt="" src="images/default/calendar-blue.gif"></td>
		    </tr>
		    <tr>
		      <th colspan="4" align="left">
		      	<span style="margin-left:102px;"><input <?php if($this->getPost['active']=='0') {echo "checked='checked'";}?> type="radio" name="active" id="active_1" value="0"> <label for="active_1">Chưa thanh toán</label>
		      	&nbsp;&nbsp;&nbsp;<input <?php if($this->getPost['active']=='1') {echo "checked='checked'";}?> type="radio" name="active" id="active_2" value="1"> <label for="active_2">Đã thanh toán</label></span>
		      </th>
		    </tr>
		    <tr>
		      <td align="right" colspan="2">
		        <input type="submit" name="SubSearch" value="Tìm kiếm" />
		      </td>
		      <td colspan="2">&nbsp;</td>
		    </tr>
		  </table>
		</form>
		</fieldset>
	</td>
  </tr>
  <tr id="serch">
    <th width="3%" class="color-tr-td">STT</th>
    <th align="center" class="color-tr-td">Họ tên</th>
    <th width="12%" class="color-tr-td">Số điện thoại</th>
    <th width="16%" class="color-tr-td">Mã đơn hàng</th>
    <th width="5%" class="color-tr-td">Active</th>
    <th width="17%" class="color-tr-td">Ngày mua</th>
     <th width="5%" class="color-tr-td">DELETE</th>
   </tr>
   <?php if (count ($this->arrContent) > 0) {
   		$i=0;
   		foreach ($this->arrContent as $arrContent) {
   ?>
	   <tr class="<?php if ($i%2==0) echo 'blue'; else echo 'white'; ?>">
	     <td align="center"><?php echo ($i + 1);?></td>
	     <td align="left"><?php echo $arrContent['hoten'];?></td>
	     <td align="center"><?php echo $arrContent['phone'];?></td>
	     <td align="center">
	     	<a onclick="ajaxDonHang('<?php echo $arrContent['maHang'];?>', '<?php echo constants::$pathUrl;?>')" href="javascript:void(0);"><?php echo $arrContent['maHang'];?></a>
	     </td>
	     <td align="center">
	     	<span id="<?php echo $arrContent['maHang'].'_a';?>">
	     		<?php if($arrContent['active'] == '0'){?><img onclick="if(comfornActive()) {ajaxActive('<?php echo $arrContent['maHang'];?>', '<?php echo constants::$pathUrl;?>');}" src="images/default/task_f2.png" width="16"/><?php }?>
	     	</span>
	     </td>
	     <td align="center"><?php echo FunctionCommon::convertDate($arrContent['insert_at'], true);?></td>
	     <?php if ($arrContent['active'] == '1') :?>
	     <td align="center"><img style="opacity:0.3;" src="images/default/b_usrdrop.png" /></td>
	   	 <?php else :?>
	   	 <td align="center">
	   	 	<span id="<?php echo $arrContent['maHang'].'_d';?>">
	   	 		<img onclick="if(cfdelete()){frmSubmit('m=home&a=donhang<?php echo constants::$pathUrl;?>', '<?php echo $arrContent['id']; ?>', 'delete', '');}" src="images/default/b_usrdrop.png" />
	   	 	</span>
	   	 </td>
	   	 <?php endif;?>
	   </tr>
	   <tr>
	   	<td colspan="7" id="<?php echo $arrContent['maHang'];?>"></td>
	   </tr>
   <?php 
   		$i++;
   		}
   }
   else {
   ?>
   		<tr><td colspan="6">Không có đơn hàng nào !</td></tr>
   <?php 
   }
   ?>
   <tr>
   		<td colspan="6" align="center"><table border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td align="right">
					<?php
					if( $this->currPage > 1 ) {
						echo "<a href=index.php?m=home&a=". (($this->getGet['type']=='s') ? 'search' : 'donhang')."&pageNo=".($this->currPage-1). constants::$pathUrl . "><span>Prev</span></a>&nbsp;&nbsp;";
					}
					?>
					</td>
					<td align="center">
					<?php
					if ($this->numberPage > 1) {
					?>
					  <table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td height="15">&nbsp;&nbsp;<?php echo $this->strPaging; ?>&nbsp;&nbsp;</td>
								</tr>
							</tbody>
						</table>
					<?php } ?>
					</td>
					<td align="left">
					<?php
					if ($this->currPage < $this->numberPage) {
						echo "&nbsp;&nbsp;<a href=index.php?m=home&a=". (($this->getGet['type']=='s') ? 'search' : 'donhang')."&pageNo=".($this->currPage+1). constants::$pathUrl . "><span>Next</span></a>";
					} 
					?>
					</td>
				</tr>
			</table>
        </td>
   </tr>
</tbody>
</table>